$(document).ready(function(){
    $("#loginbtn").click(function () {
        $.ajax({
            type:"post",
            url:"user/login",
            async:true,
            dataType:"json",
            data:{
                u_name:$("#u_name").val(),
                u_psd:$("#u_psd").val()
            },
            success:function(rs){
                console.info(rs);
                var errorCode = rs.errorCode;
                if (errorCode==0){
                    $(location).attr("href","gotoroom");
                    alert(JSON.stringify(rs));
                } else{
                    var msg = rs.status;
                     $("#u_psd").val("");
                    $("#errorLog").text(msg);
                    $("#errorLog").removeClass("hidden");
                }

            },
            error:function(XMLHttpRequest, textStatus, errorThrown){
                this;
            }
        });
    });
    //
    $(".img-circle").click(function () {
        $(location).attr("href","gotoregister");
    });
});
